package com.lhc.List;

import java.util.ArrayList;
import java.util.List;

public class ListDemo {
    public static void main(String[] args) {

    }

    private static void test()
    {
        //创建list集合对象
        //多态：父类指代子类
        //面向接口编程思想
        List list=new ArrayList();
        //存入元素
        list.add("zhangsan");
        list.add("lisi");
        list.add("wangwu");

        //输出元素
        for(int i=0;i<list.size();i++)
        {
            System.out.println(list.get(i));
        }

        for (Object obj:list) {
            System.out.println(obj.toString());
        }
    }
}
